package Algorithm;
import java.util.Map;
import java.util.HashMap;

public class SamaChar_02 {
    public static boolean check(String s1,String s2){
        Map<Character,Integer> map=new HashMap<>();
        //扫描s1
        for(int i=0;i<s1.length();i++){
            char c=s1.charAt(i);
            if(map.get(c)==null){ //如果对应的键为空就存入
                map.put(c,1); //存入
            }
        }
        //扫描s2
        for(int i=0;i<s2.length();i++){
            char c=s2.charAt(i);
            if(map.get(c)==null){  //扫描
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(check("abcd","aaabcddccsbb"));
    }
}
